home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Celestin Apprentice 5
/
Apprentice-Release5.iso
/
Demos
/
Bowers Development
/
AppMaker 2.0b5
/
Examples
/
Java
/
Everything
/
RectPanel.java
< prev
next >
Wrap
Text File
|
1996-06-12
|
722b
|
40 lines
// a simple panel that draws a rectangle
import java.awt.Panel;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Insets;
import java.awt.Rectangle;
public class RectPanel extends Panel
{
public void paint (Graphics g)
{
int x, y, width, height;
Rectangle r = this.bounds();
x = 1;
y = 1;
width = r.width - 3;
height = r.height - 2;
Color oldColor = g.getColor();
Color c = Color.lightGray;
Color brighter = c.brighter();
Color darker = c.darker();
g.setColor(darker);
g.drawRect(x, y, width, height);
g.setColor(brighter);
g.drawRect(x + 1, y + 1, width, height);
g.setColor(oldColor);
}
public Insets insets()
{
return new Insets (2, 2, 2, 2);
}
}